#ifndef HEAPTASK_H
#define HEAPTASK_H

#include <QtCore>
#include <stdio.h>

#include "myheap.h"

namespace sk {

class HeapTest : public QObject {
    Q_OBJECT

public:
    HeapTest(QObject *parent = 0) : QObject(parent) {}

public slots:
    void run() {
        printf("Heap test started\n");

        MyArray arr;
        arr.add(0);
        arr.add(1);
        arr.add(9);
        arr.add(2);
        arr.add(8);
        arr.add(3);
        arr.add(7);
        arr.add(4);
        arr.add(6);
        arr.add(5);

        MyHeap *heap = new MyHeapImp();
        heap->buildHeap(arr);
        heap->print();

        printf("\n");

        int a[] = {0, 1, 9, 2, 8, 3, 7, 4, 6, 5};
        heapsort(a, sizeof(a) / sizeof(int));

        printf("\n");

        emit finished();
    }

signals:
    void finished();
};

}

#endif // HEAPTASK_H
